package com.tongji.seller.command
{
	import com.tongji.seller.events.GetSavedProductEvent;
	import com.tongji.seller.model.StoreProductModel;
	import com.tongji.seller.service.StoreProductService;
	
	import org.robotlegs.mvcs.Command;
	
	/**
	 *
	 * @author caddy
	 * @date 2011-12-15
	 */
	public class GetSavedProductCommand extends Command
	{
		[Inject]
		public var service:StoreProductService;
		
		[Inject]
		public var model:StoreProductModel;
		
		[Inject]
		public var event:GetSavedProductEvent;
		
		override public function execute():void
		{
			switch(event.type)
			{
				case GetSavedProductEvent.GET_SAVED_PRODUCT:
				{
					service.getAllStoreItemInfo(event.userID);
					break;
				}
				case GetSavedProductEvent.UPDATE_SAVED_PRODUCT:
					model.updateSavedProduct(event.product);
					break;
				default:
				{
					break;
				}
			}
		}
	}
}